import 'package:hive/hive.dart';
import 'package:json_annotation/json_annotation.dart';

part 'user_company.g.dart';

@HiveType(typeId: 2)
@JsonSerializable()
class AppCompanyDto {
  @HiveField(0)
  final String? id;

  @HiveField(1)
  final String? gmtCreate;

  @HiveField(2)
  final String? gmtModified;

  @HiveField(3)
  final String? name;

  @HiveField(4)
  final String? userId;

  @HiveField(5)
  final String? taxCode;

  @HiveField(6)
  final String? nationalName;

  @HiveField(7)
  final String? nationalPwd;

  @HiveField(8)
  final String? taxPayerPhone;

  @HiveField(9)
  final String? status;

  @HiveField(10)
  final String? province;

  @HiveField(11)
  final String? city;

  @HiveField(12)
  final String? loginWay;

  @HiveField(13)
  final String? isDefault;

  AppCompanyDto({
    this.id,
    this.gmtCreate,
    this.gmtModified,
    this.name,
    this.userId,
    this.taxCode,
    this.nationalName,
    this.nationalPwd,
    this.taxPayerPhone,
    this.status,
    this.province,
    this.city,
    this.loginWay,
    this.isDefault,
  });

  factory AppCompanyDto.fromJson(Map<String, dynamic> json) {
    return AppCompanyDto(
      id: json['id']?.toString(),
      gmtCreate: json['gmtCreate']?.toString(),
      gmtModified: json['gmtModified']?.toString(),
      name: json['name'] as String?,
      userId: json['userId']?.toString(),
      taxCode: json['taxCode'] as String?,
      nationalName: json['nationalName'] as String?,
      nationalPwd: json['nationalPwd'] as String?,
      taxPayerPhone: json['taxPayerPhone'] as String?,
      status: json['status']?.toString(),
      province: json['province'] as String?,
      city: json['city'] as String?,
      loginWay: json['loginWay']?.toString(),
      isDefault: json['isDefault']?.toString(),
    );
  }

  Map<String, dynamic> toJson() => _$AppCompanyDtoToJson(this);
}